package cc.chinagps.gateway.log;

import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class LogManager {
	public static final String LOGGER_NAME_CMD = "nameCmd";
	public static final String LOGGER_NAME_UNKNOWN_CMD = "nameUnknownCmd";
	public static final String LOGGER_NAME_EXCEPTION = "nameException";
	public static final String LOGGER_NAME_ALARM = "nameAlarm";
	public static final String LOGGER_NAME_OTHERS = "nameOthers";
	public static final String LOGGER_NAME_DEBUG = "nameDebug";
	public static final String LOGGER_NAME_TRANSFER = "transfer";

	private static Logger logger_debug = LoggerFactory.getLogger(LOGGER_NAME_DEBUG);
	private static Logger logger_error = LoggerFactory.getLogger(LOGGER_NAME_EXCEPTION);
	private static Logger logger_transfer = LoggerFactory.getLogger(LOGGER_NAME_TRANSFER);
	
	public static void init(){
		String filePath = "config/log4j.properties";
		PropertyConfigurator.configure(filePath);
		PropertyConfigurator.configureAndWatch(filePath,60000);
	}

	public static void d(String msg, Object... o) {
		logger_debug.debug(msg, o);
	}

	public static void d(String msg, Throwable t) {
		logger_debug.debug(msg, t);
	}

	public static void e(String msg, Throwable t) {
		logger_error.debug(msg, t);
	}

	public static void t(String msg, Object... o) {
		logger_transfer.debug(msg, o);
	}

	public static void t(String msg, Throwable t) {
		logger_transfer.debug(msg, t);
	}
	
}